##
## Makefile for pud in mrcellophane/libpud
## 
## Made by solomon hykes
## Login   <torgau@gmail.com>
## 
## Started on  Mon May 16 15:01:28 2005 solomon hykes
## Last update Thu Jul 14 14:38:49 2005 solomon hykes
##

STATIC=libpud.a

SYS	= `uname -s`
RM	= rm -fr
CC	= gcc
CFLAGS	= -g3
LDFLAGS	= -L. -lpud

all: $(STATIC) pscat target pswrite pscode

psmap: $(STATIC) psmap.o
	$(CC) psmap.o -o psmap $(LDFLAGS)

psalloc: $(STATIC) psalloc.o	
	$(CC) psalloc.o -o psalloc $(LDFLAGS)

pscode: $(STATIC)
	$(CC) $(CFLAGS) pscode.c -o pscode $(LDFLAGS)

pscat: $(STATIC)
	$(CC) $(CFLAGS) pscat.c -o pscat $(LDFLAGS)

pswrite: $(STATIC)
	$(CC) $(CFLAGS) pswrite.c -o pswrite $(LDFLAGS)

$(STATIC): sys_$(STATIC)
	ln -sf sys/$(SYS)/$(STATIC) $(STATIC)

clean: sys_clean
	$(RM) *~ *.core core

distclean: sys_distclean
	$(RM) $(STATIC) pscat target

re: distclean all

# subdirectories

sys_clean:
	{ cd sys/$(SYS) && make clean; }

sys_distclean:
	{ cd sys/$(SYS) && make distclean; }

sys_$(STATIC):
	{ cd sys/$(SYS) && make $(STATIC); }
